@extends('layout.admin.index')
<?php $left_selected = '权限管理'; $center_selected = isset($admin)?'管理员修改':'管理员添加'?>
@section('main')
<div class="mws-panel grid_8">
    <div class="mws-panel-header">
        <span>{{isset($admin)?'管理员修改':'管理员添加'}}</span>
    </div>

    @if (count($errors) > 0)
          <div class="mws-form-message error">
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif

    <div class="mws-panel-body no-padding">
        <form action="{{route('admin.save',['id'=>isset($admin->id)?$admin->id:''])}}" method="post" class="mws-form">
           <input type="hidden" name="_token" value="{{ csrf_token() }}">
           <input type="hidden" name="_method" value="put">
            <div class="mws-form-inline">
                <div class="mws-form-row">
                    <label class="mws-form-label">用户名</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="username" value="{{ isset($admin->username)?$admin->username:'' }}">
                </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">密码</label>
                    <div class="mws-form-item">
                        <input type="password" class="small" name="password" value="{{isset($admin->password)?$admin->password:''}}">
                    </div>
                </div>
                @if(!isset($admin->id))
                    <div class="mws-form-row">
                        <label class="mws-form-label">确认密码</label>
                        <div class="mws-form-item">
                            <input type="text" class="small" name="repassword">
                        </div>
                    </div>
                @endif
                <div class="mws-form-row">
                    <label class="mws-form-label">邮箱</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="email" value="{{ isset($admin->email)?$admin->email:'' }}">
                    </div>
                </div>

            <div class="mws-button-row">

                <input type="submit" class="btn btn-danger" value="修改">
                <input type="reset" class="btn " value="重置">
            </div>
        </form>
    </div>
</div>
@endsection